<script setup lang="ts">
import * as echarts from 'echarts';

//页面加载完成后加载我们的图标
import { onMounted } from 'vue'

onMounted(async () => {

    var chartDom = document.getElementById('echartsMain-Line');
    var myChart = echarts.init(chartDom);
    myChart.resize({
        width: 1200,
        height: 260
    })

    var option = {
        title: {
            text: '完成需求时间',
            left: 'center'
        },
        tooltip: {
            trigger: 'axis'
        },
        grid: {
            left: '3%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            name: '完成时间',
            type: 'category',
            data: ['一周', '两周', '一个月', '两个月', '三个月', '半年']
        },
        yAxis: {
            name: '完成数量',
            type: 'value'
        },
        series: [
            {
                name: '完成数量',
                type: 'line',
                stack: 'Total',
                smooth: true,
                data: [150, 230, 224, 218, 135, 147],
                lineStyle: {
                    normal: {
                        width: 2,
                        type: 'solid',
                        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                            offset: 0,
                            color: 'blue'
                        }, {
                            offset: 1,
                            color: 'red'
                        }
                        ])
                    }
                }
            }
        ]
    };

    option && myChart.setOption(option);
})


</script>

<template>
    <div id="echartsMain-Line"></div>
</template>